package com.skzh.web.controller.healthy;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.skzh.common.annotation.Log;
import com.skzh.common.core.controller.BaseController;
import com.skzh.common.core.domain.AjaxResult;
import com.skzh.common.enums.BusinessType;
import com.skzh.healthy.domain.EquipmentAlarm;
import com.skzh.healthy.service.IEquipmentAlarmService;
import com.skzh.common.utils.poi.ExcelUtil;
import com.skzh.common.core.page.TableDataInfo;

/**
 * 设备告警Controller
 */
@RestController
@RequestMapping("/healthy/equipmentalarm")
public class EquipmentAlarmController extends BaseController {
    @Autowired
    private IEquipmentAlarmService equipmentAlarmService;

    /**
     * 查询设备告警列表
     */
    @PreAuthorize("@ss.hasPermi('healthy:equipmentalarm:list')")
    @GetMapping("/list")
    public TableDataInfo list(EquipmentAlarm equipmentAlarm) {
        startPage();
        List<EquipmentAlarm> list = equipmentAlarmService.selectEquipmentAlarmList(equipmentAlarm);
        return getDataTable(list);
    }

    /**
     * 导出设备告警列表
     */
    @PreAuthorize("@ss.hasPermi('healthy:equipmentalarm:export')")
    @Log(title = "设备告警", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EquipmentAlarm equipmentAlarm) {
        List<EquipmentAlarm> list = equipmentAlarmService.selectEquipmentAlarmList(equipmentAlarm);
        ExcelUtil<EquipmentAlarm> util = new ExcelUtil<EquipmentAlarm>(EquipmentAlarm.class);
        util.exportExcel(response, list, "设备告警数据");
    }
}
